'use strict';
//菜单管理
const Controller = require('egg').Controller;

class MenuController extends Controller {
  //查询菜单管理级权限
  async getmenutotal() {
    const data = await this.ctx.service.menu.getmenutotal();
    this.ctx.body = data;
  }
  //删除父级菜单----------------------------------------------------------------------------------------------------------------
  async delfather() {
    const name = this.ctx.request.body;
    const data = await this.ctx.service.menu.delfather(name);
    this.ctx.body = data;
  }
  //删除子级菜单
  async delson() {
    const name = this.ctx.request.body;
    const data = await this.ctx.service.menu.delson(name);
    this.ctx.body = data;
  }
  //添加菜单的父级数据----------------------------------------------------------------------------------------------------------------
  async getmenuname() {
    const data = await this.ctx.service.menu.getmenuname();
    this.ctx.body = data;
  }
  //添加菜单----------------------------------------------------------------------------------------------------------------
  async cremenu() {
    const body = this.ctx.request.body;
    const data = await this.ctx.service.menu.cremenu(body);
    this.ctx.body = data;
  }
  //修改子级菜单----------------------------------------------------------------------------------------------------------------
  async sonupdate() {
    const body = this.ctx.request.body;
    const data = await this.ctx.service.menu.sonupdate(body);
    this.ctx.body = data;
  }
  //修改父级菜单
  async fatherupdate() {
    const body = this.ctx.request.body;
    const data = await this.ctx.service.menu.fatherupdate(body);
    this.ctx.body = data;
  }
}

module.exports = MenuController;
